from django.conf import settings

from chat.models import Message


def custom_context(request):
    low = settings.LOW
    low_color = settings.LOW_COLOR
    low_opacity = settings.LOW_OPACITY
    message_count = Message.objects.filter(receiver_id=request.user.id, read=False).count()
    if message_count > 99:
        message_count = '99+'
    return {
        'low': low,
        'low_color': low_color,
        'low_opacity': low_opacity,
        'message_count': message_count,
    }
